package biz.ezcom.design.pattern.visitor;

import java.util.ArrayList;
import java.util.List;

public class Client {
	/**
	 * Person的子类必须是已经确定数量的，后期不能有变化
	 * Visitor的子类可以变化数据 
	 */
	public static void main(String[] args) {
		List<Person> personList = new ArrayList<Person>(2);
		personList.add(new PersonMan());
		personList.add(new PersonWoman());
		
		Visitor failVisitor = new VisitorFail();
		for(Person person : personList){
			person.accept(failVisitor);
		}
		
		Visitor successVisitor = new VisitorSuccess();
		for(Person person : personList){
			person.accept(successVisitor);
		}
	}
}
